package com.ui.DialogFragment;

import android.app.Dialog;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;


import com.orangelife.R;

import java.util.List;

/**
 * 代码参考:
 * heguorui/HBottomPopMenuDemo
 * https://github.com/heguorui/HBottomPopMenuDemo
 * Created by ZeroVoid on 2018-8-13.
 */

public class MenuDialogFrgm extends DialogFragment {
    public MenuDialogFrgm() {
        // Required empty public constructor
    }

    private List<MenuItem> menuItems;

    public List<MenuItem> getMenuItems() {
        return menuItems;
    }

    public void setMenuItems(List<MenuItem> menuItems) {
        this.menuItems = menuItems;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        Dialog dialog = getDialog();
        dialog.requestWindowFeature(Window.FEATURE_NO_TITLE);//无标题
        Window window = dialog.getWindow();
        if (window != null) {
            window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));//设置背景透明
            window.setWindowAnimations(R.style.AppTheme);
        }
        View view = inflater.inflate(R.layout.dialog_fragment_frgm, container, false);

        return super.onCreateView(inflater, container, savedInstanceState);
    }
}
